cmake_minimum_required(VERSION 3.0)
project(spk_camera)

set(SRC_FOLDERS logs utils common msg_queue config spk_camera video audio gb28181_client linux_client)
set(INCLUDE ${SRC_FOLDERS})

set(SOURCE_FILES_TMP "")
set(HEADER_FILES_TMP "")

# we could use aux_source_directory(), `aux_source_directory(. source)`
# which add files according to language currently used

foreach(SRC_FOLDER ${SRC_FOLDERS})
    file(GLOB SOURCE_FILES_TMP CONFIGURE_DEPENDS
        "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FOLDER}/*.c"
        "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FOLDER}/*.cpp")
    list(APPEND SOURCE_FILES ${SOURCE_FILES_TMP})

    file(GLOB HEADER_FILES_TMP CONFIGURE_DEPENDS
        "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FOLDER}/*.h"
        "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FOLDER}/*.hpp")
    list(APPEND HEADER_FILES ${HEADER_FILES_TMP})
endforeach()



list(APPEND SOURCE_FILES "main.cpp")
message("Source Files: ${SOURCE_FILES}")
message("Header Files: ${HEADER_FILES}")

# standalone
add_executable(main ${SOURCE_FILES} ${HEADER_FILES} )

target_link_libraries(main PRIVATE mpp ffmpeg sip)
target_include_directories(main PRIVATE ${INCLUDE} )

add_custom_target(run COMMAND $<TARGET_FILE:main>)
add_dependencies(run main)
